<template>
	<el-form-item prop="inputValue" :label="itemLabel">
		<el-radio-group v-model="inputValue" v-if="visibleEl==1">
		    <el-radio v-for="i in parameterOptions" :label="i.name" :key="i.value" :value="i.value">{{i.name}}</el-radio>
		</el-radio-group>
		<el-checkbox-group  v-model="inputValue" v-else-if="visibleEl==2">
			<el-checkbox v-for="i in parameterOptions" :label="i.name" :key="i.value" :value="i.value">{{i.name}}</el-checkbox>
		</el-checkbox-group>
		<el-select v-model="inputValue" :placeholder="placeholderData" filterable v-else-if="visibleEl==3">
		  <el-option v-for="i in parameterOptions" :key="i.value" :label="i.name" :value="i.value">{{i.name}}</el-option>
		</el-select>
		<el-input v-model="inputValue" :placeholder="placeholderData" auto-complete="off" v-else-if="visibleEl==4"></el-input>
		<el-input v-model="inputValue" :placeholder="placeholderData" auto-complete="off" :rows="6" resize="none" type="textarea" maxlength="120" v-else-if="visibleEl==5"></el-input>
		<el-input v-model="inputValue" :placeholder="placeholderData" auto-complete="off" :rows="20" resize="none" type="textarea" maxlength="1024" v-else-if="visibleEl==6"></el-input>
	</el-form-item>
</template>
<script>/** 参数配置输入框 **/
import sys_sysParameter from "@/api/sys/sysParameter";
export default {
	name: "sysParameterHtml",
	props: [
		"placeholderData",//默认输入框内容
		"numb",//参数编码
	],
	data() {
		return {
			parameterOptions: [],
			inputValue: null,
			visibleEl: 1,
			itemLabel: null
		};
	},
	watch: {
		"inputValue"(value){
			this.$emit('toBackFun',value);//回调函数
		}
	},
	computed: {
	},
	mounted(){
		this.getSysParameterData();
	},
	methods: {
		async getSysParameterData(){//类型 1单选框  2复选框 3下拉框 4输入框 5文本框 6富文本输入域
			sys_sysParameter.getByNumb(this.numb).then(res => {
				if(res.data.code === 2000) {
					this.parameterOptions = res.data.data.nameValues;
					this.itemLabel = res.data.data.parameterName;
					this.visibleEl = res.data.data.dataType;
					if(res.data.dataType==1){
						  
					}else if(res.data.dataType==2){
						  
					}else if(res.data.dataType==3){
						  
					}else if(res.data.dataType==4){
						  
					}else if(res.data.dataType==5){
						  
					}else if(res.data.dataType==6){
						  
					}
				}
			});
		},
	}
}
</script>